You're re-declaring placeholder in that code.
Code:
strcat("ObjectRef" , toString(index));
I hope you don't actually do that, because string literals are supposed to be constant.
If you're going to make up code that demonstrates a point, try to ensure that it is correct.
But I know what you mean.
Probably the best way to do that is to use only one variable if possible. If that's not possible, you could use something linear -- for example, appending a name onto a list of other names.
You could also "unroll" the loop, e.g.,
Code:
for(int i = 0; i < 3; i ++) std::cout << i << std::endl;
->
Code:
std::cout << 0 << std::endl;
std::cout << 1 << std::endl;
std::cout << 2 << std::endl;
But these are just hacks to get around what should be implemented with arrays. I know no arrays are allowed, but that's just plain stupid.
You could always use a container instead of an array. Like a vector or something . . .